home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / system / network / daemons / nfs / nfs-serv.2be / nfs-serv / nfs-server-2.2beta16 / fakefsuid.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-12-26  |  757 b   |  37 lines

  1. /*
  2.  * This header file fakes the setfsuid call if we're on Linux i386
  3.  * and the call is not present in libc.
  4.  */
  5.  
  6. #if !defined(HAVE_SETFSUID) && defined(MAYBE_HAVE_SETFSUID)
  7.  
  8. #include <linux/unistd.h>
  9.  
  10. /* stolen from /usr/include/asm/unistd.h */
  11. static inline int setfsuid(uid_t fsuid)
  12. {
  13.     long __res;
  14.     __asm__ volatile ("int $0x80"
  15.         : "=a" (__res)
  16.         : "0" (__NR_setfsuid),"b" ((long)(fsuid)));
  17.     if (__res >= 0)
  18.         return (int) __res;
  19.     errno = -__res;
  20.     return -1;
  21. }
  22.  
  23. static inline int setfsgid(gid_t fsgid)
  24. {
  25.     long __res;
  26.     __asm__ volatile ("int $0x80"
  27.         : "=a" (__res)
  28.         : "0" (__NR_setfsgid),"b" ((long)(fsgid)));
  29.     if (__res >= 0)
  30.         return (int) __res;
  31.     errno = -__res;
  32.     return -1;
  33. }
  34.  
  35.  
  36. #endif    /* !defined(HAVE_SETFSUID) && defined(MAYBE_HAVE_SETFSUID) */
  37.